package com.ruoyi.cmdb.service.impl;

import java.util.List;

import com.ruoyi.cmdb.util.GetId;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.cmdb.mapper.ServiceDependencyTypeMapper;
import com.ruoyi.cmdb.domain.ServiceDependencyType;
import com.ruoyi.cmdb.service.IServiceDependencyTypeService;

/**
 * 服务依赖类型Service业务层处理
 *
 * @author ruoyi
 * @date 2023-01-28
 */
@Service
public class ServiceDependencyTypeServiceImpl implements IServiceDependencyTypeService
{
    GetId getId=new GetId();//用这个类的方法生成当前时间的id
    @Autowired
    private ServiceDependencyTypeMapper serviceDependencyTypeMapper;

    /**
     * 查询服务依赖类型
     *
     * @param id 服务依赖类型主键
     * @return 服务依赖类型
     */
    @Override
    public ServiceDependencyType selectServiceDependencyTypeById(String id)
    {
        return serviceDependencyTypeMapper.selectServiceDependencyTypeById(id);
    }

    /**
     * 查询服务依赖类型列表
     *
     * @param serviceDependencyType 服务依赖类型
     * @return 服务依赖类型
     */
    @Override
    public List<ServiceDependencyType> selectServiceDependencyTypeList(ServiceDependencyType serviceDependencyType)
    {
        return serviceDependencyTypeMapper.selectServiceDependencyTypeList(serviceDependencyType);
    }

    /**
     * 新增服务依赖类型
     *
     * @param serviceDependencyType 服务依赖类型
     * @return 结果
     */
    @Override
    public int insertServiceDependencyType(ServiceDependencyType serviceDependencyType)
    {
        serviceDependencyType.setId(getId.getTimeId());
        serviceDependencyType.setCreateTime(DateUtils.getNowDate());
        return serviceDependencyTypeMapper.insertServiceDependencyType(serviceDependencyType);
    }

    /**
     * 修改服务依赖类型
     *
     * @param serviceDependencyType 服务依赖类型
     * @return 结果
     */
    @Override
    public int updateServiceDependencyType(ServiceDependencyType serviceDependencyType)
    {
        serviceDependencyType.setUpdateTime(DateUtils.getNowDate());
        return serviceDependencyTypeMapper.updateServiceDependencyType(serviceDependencyType);
    }

    /**
     * 批量删除服务依赖类型
     *
     * @param ids 需要删除的服务依赖类型主键
     * @return 结果
     */
    @Override
    public int deleteServiceDependencyTypeByIds(String[] ids)
    {
        return serviceDependencyTypeMapper.deleteServiceDependencyTypeByIds(ids);
    }

    /**
     * 删除服务依赖类型信息
     *
     * @param id 服务依赖类型主键
     * @return 结果
     */
    @Override
    public int deleteServiceDependencyTypeById(String id)
    {
        return serviceDependencyTypeMapper.deleteServiceDependencyTypeById(id);
    }
}
